package com.enjoyor.soa.traffic.server.efoms.dubbo.listener;

import com.enjoyor.soa.traffic.core.efoms.enums.EnumMessage;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 事件发布
 * @ClassNameMessagePushListenerImpl
 * @Description TODO
 * @Author ZSY
 * @Date 2019/1/17 10:00
 * @Version 1.0
 **/

@Component
public class MessagePushClientImpl implements MessagePushClient {

    @Resource
    private ApplicationContext applicationContext;

    /**
     */
    @Override
    public void publish(String operationName,String devTypeCode) {
        //通过上下文对象发布监听
        applicationContext.publishEvent(new MessagePushEventPojo(this, operationName,devTypeCode));
    }

    @Override
    public void repMsgApply() {
        publish(EnumMessage.REP_MSG_APPLY.getKey(),null);
    }

    @Override
    public void repMsgPress() {
        publish(EnumMessage.REP_MSG_PRESS.getKey(),null);
    }

    @Override
    public void ordMsgSure() {
        publish(EnumMessage.ORD_MSG_SURE.getKey(),null);
    }

    @Override
    public void ordMsgFackback() {
        publish(EnumMessage.ORD_MSG_FACKBACK.getKey(),null);
    }

    @Override
    public void ordMsgPress() {
        publish(EnumMessage.ORD_MSG_PRESS.getKey(),null);
    }

    @Override
    public void ordMsgPostpone() {
        publish(EnumMessage.ORD_MSG_POSTPONE.getKey(),null);
    }

    @Override
    public void ordMsgIsreject() {
        publish(EnumMessage.ORD_MSG_ISREJECT.getKey(),null);
    }

    @Override
    public void getCheckPushNumList(String devTypeCode) {
    	// TODO Auto-generated method stub
    	publish(EnumMessage.CHE_MSG_NUMLIST.getKey(),devTypeCode);
    }
    
    @Override
    public void getSurveyPushNumList(String devTypeCode) {
    	// TODO Auto-generated method stub
    	publish(EnumMessage.SUR_MSG_NUMLIST.getKey(),devTypeCode);
    }
    
    @Override
    @Scheduled(cron = "0 0/30 * * * ?")
    public void ordMsgOvertime() {
        publish(EnumMessage.ORD_MSG_OVERTIME.getKey(),null);
    }

	@Override
	public void getRepSubmitPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.RPE_SUBMIT_REMIND.getKey(),null);
	}

	@Override
	public void getRepPressPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.RPE_PRESS_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersSellPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_SELL_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersPressPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_PRESS_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersScheTickPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_SCHE_TICK_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersDelayPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_DELAY_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersFinishedPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_FINISHED_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersDelayAuditPushMessage() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_DELAY_AUDIT_REMIND.getKey(),null);
	}

	@Override
	public void getOrdersFinishedAudit() {
		// TODO Auto-generated method stub
		publish(EnumMessage.ORDERS_FINISHED_AUDIT_REMIND.getKey(),null);
	}
}
